package com.wanyang.service;

import cn.hutool.core.bean.BeanUtil;
import com.wanyang.dos.ProblemFeedbackDO;
import com.wanyang.dto.ProblemFeedbackDTO;
import com.wanyang.mapper.ProblemFeedbackDOMapper;
import com.wanyang.utils.DateUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class ProblemFeedbackServiceImpl implements ProblemFeedbackService {
    @Resource
    private ProblemFeedbackDOMapper problemFeedbackDOMapper;

    @Override
    public void submit(ProblemFeedbackDTO problemFeedbackDTO) {
        ProblemFeedbackDO problemFeedbackDO = BeanUtil.copyProperties(problemFeedbackDTO, ProblemFeedbackDO.class);
        problemFeedbackDO.setCreateUser(UserContext.get().getId());
        problemFeedbackDO.setCreateTime(DateUtil.currentUnixTime());
        problemFeedbackDOMapper.insertSelective(problemFeedbackDO);
    }
}
